home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / audacity / plug-ins / vocalremover.ny < prev    next >
Encoding:
Audacity Nyquits plug-in  |  2010-09-21  |  6.4 KB  |  107 lines

  1. ;nyquist plug-in
  2. ;version 3
  3. ;type process
  4. ;categories "http://lv2plug.in/ns/lv2core#UtilityPlugin"
  5. ;name "Vocal Remover (for center-panned vocals)..."
  6. ;action "Removing vocals or other center-panned audio..."
  7. ;info "by David R. Sky www.shellworld.net/~davidsky/ \nReleased under terms of the GNU General Public License version 2 \nRemoves center-panned audio in a stereo track by inversion and panning to center.\n\n'Simple' removal removes all the center-panned audio. If too much audio is removed,\ntry removing only selected frequencies - enter these in the box 'Frequency band\nlower and upper limit'. Then choose 'Remove band' to remove only frequencies in\nthat band, or 'Retain band' to remove only frequencies outside that band. After\nremoval, the audio will sound mono because both channels are panned to center.\n\nFor further help, select 'View Help' in the first dropdown menu and click OK. After\nreading Help, please reopen Vocal Remover to use it.\n"
  8.  
  9.  
  10. ;control action "Remove vocals or view Help" choice "Remove vocals,View Help" 0
  11. ;control bc "Removal choice" choice "Simple (entire spectrum),Remove frequency band,Retain frequency band" 0
  12. ;control range "Frequency band lower and upper limit [Hz]\n [Enter two values between 0 and 20000]" string " " "500 2000"
  13.  
  14. ; Center pan Remover by David R. Sky November 12, 2004
  15. ; updated October/November 2007. Further modified by 
  16. ; Gale Andrews January 2008 to make full spectrum removal 
  17. ; the default, restore a single Help screen and restore error checking.
  18. ; Ideally wants rewriting so that no error checking occurs when
  19. ; default full spectrum removal selected.
  20. ; Thanks to David Hostetler for notes in his own vocal remover plug-in,
  21. ; which makes this plug-in more effective. See -
  22. ; http://www.freelists.org/archives/audacity4blind/06-2006/msg00049.html
  23.  
  24. (cond ; either explain this effect or perform it
  25. ((= action 1) ; display Help screen
  26. (format nil
  27. "Vocal Remover requires a stereo track and works best on audio in a lossless format\nlike WAV or AIFF rather than a compressed, lossy format like MP3. If your song is on\na CD, use a program like CD-ex to rip it to WAV or AIFF before using Vocal Remover. 
  28.  
  29. Vocals (or other audio) can only be removed with this plug-in when panned to center,\nin other words sounding equally loud in both left and right channels. Vocals are often\nrecorded this way. When one channel is inverted and then both panned to center,\nany audio which is identical in both channels is cancelled out, so becomes inaudible.\nThis means that if audio you don't want to remove also happens to be center-panned,\nit will be cancelled out along with the vocals. Drums are an example of audio that is\noften center-panned and can thus disappear when vocals are removed. However, if\nthe vocals and other center-panned parts of the audio differ from each other in pitch\n(and thus in frequency), removing only selected frequencies from the audio can solve\nsuch problems. 
  30.  
  31. Vocal Remover therefore has three choices of removal method. 'Simple' inverts the\nentire frequency spectrum of one channel. If all the audio except the vocals is panned\nhard away from center, this will work the best. If some of the other audio is common\nto both channels, this choice may remove too much music, in which case try the\nremaining options. 'Remove frequency band' removes frequencies in a band whose\nupper and lower limit you specify in the 'Frequency band...' box. Try this choice,\nentering the approxmate frequency range of the vocals, if they are apparently at a\nvery different pitch than the other audio (for example, a high female voice). 'Retain\nfrequency band' removes only those frequencies lying outside the limit you specify,\nretaining the others. This choice can help if there is audio of a particular frequency\nrange (such as low drums or bass) that is lost when using the other methods. Simply\nenter the approximate frequency range of the audio you wish to retain."))
  32.  
  33.  
  34. (t ; perform effect
  35. (defun string-to-list (str)
  36. (read (make-string-input-stream (format nil "(~a)" str))))
  37.  
  38.  
  39. (setf range (string-to-list range))
  40.  
  41. ; initialize empty error-msg
  42. (setf error-msg "")
  43.  
  44. ; Error-checking...
  45. ;
  46. ; check that selected audio is stereo
  47. (setf error-msg (if (arrayp s)
  48. error-msg
  49. (strcat error-msg (format nil
  50. "Error:\n\nVocal Remover requires an unsplit, stereo track.\n\nIf you have a stereo track split into left and right\nchannels, use 'Make Stereo Track' on the Track\nDropdown Menu, then run Vocal Remover again. 
  51. "))))
  52.  
  53.  
  54. ; Check there are two input frequency values given. If not and remove or retain band is selected,  
  55. ; ask to enter their required values. If not and 'Simple' removal selected, ask to enter any two values. 
  56. (setf error-msg (if 
  57. (and (> bc 0)
  58. (< (length range) 2))
  59. (strcat error-msg (format nil
  60. "Error:\n\nPlease enter both a lower and upper value for the\nfrequency band you want to remove or retain.\n\nBoth values must be between 0 and 20000.
  61. " (nth bc '("" ""))))
  62.  
  63. ; are range values numbers?  
  64. (if
  65. (or (not (numberp (first range))) (not (numberp (second range))))
  66. (strcat error-msg (format nil
  67. "To perform 'Simple' removal you can enter any\ntwo numbers (separated by a space) in the\n'Frequency band lower and upper limit' box.\nThe numbers entered don't affect the result.\n\nTo remove or retain a frequency band, enter\nlower and upper values for the band between\n0 and 20000.
  68. " (first range) (second range)))
  69.  
  70. ; if 'Simple' removal not selected, throw error if both frequency values are not between 0 and 20000
  71. (if (or (= bc 0)
  72. (and 
  73. (>= (first range) 0) (<= (first range) 20000)
  74. (>= (second range) 0) (<= (second range) 20000)))
  75. error-msg
  76. (strcat error-msg (format nil
  77. "Error:\n\n~aAt least one frequency value in your band is invalid. \nYou entered: ~a   ~a\n\nBoth the lower and upper values must be between\n0 and 20000.
  78. "(nth bc '("" "" ""))
  79. (first range) (second range)))))))
  80.  
  81.  
  82. (cond
  83. ((> (length error-msg) 0)
  84. (format nil "~a" error-msg))
  85.  
  86. (t ; no error msg
  87. (setf lower (min (first range) (second range)))
  88. (setf upper (max (first range) (second range)))
  89.  
  90.  
  91. (cond
  92. ((= bc 1) ; invert [delete] band of frequencies inside range
  93. (sum (aref s 0) (mult -1 (aref s 1))
  94. (highpass8 (aref s 1) upper)
  95. (lowpass8 (aref s 1) lower)))
  96.  
  97. ((= bc 2) ; invert [delete] frequencies outside band range
  98. (sum (aref s 0) (mult -1 (aref s 1))
  99. (highpass8 (lowpass8 (aref s 1) upper) lower)))
  100.  
  101. (t ; invert one channel
  102. (sum (aref s 0) (mult -1 (aref s 1)))))
  103. ) ; end t apply effect
  104. ) ; end cond between display error msg or apply effect
  105. ) ; end t perform effect
  106. ) ; end cond explain effect or perform it
  107.